package biolabs.visual

/** An object that, given a configuration,
  * can produce its visual representation.
  *
  * Each non-abstract class that inherits this trait should provide
  * its own implementation of this trait, so that the most concrete
  * implicit [[scala.reflect.Manifest]] can be inferred in the call
  * to [[biolabs.visual.VisualizationConfiguration]]`.get`.
  *
  * Models defined using MCL implement this trait automatically.
  */
trait Visualizable {

	/** Indicates whether the given visualization configuration
	  * specifies a suitable visualizer for this object.
	  */
	def canVisualize[R](config: VisualizationConfiguration[R]): Boolean

	/** Produces a visual representation of this object, if `config`
	  * defines a suitable visualizer for this object. It can use
	  * `config` to produce visual representations of any contained
	  * objects and incorporate them into the result.
	  *
	  * @return a visual representation of this object, or `None`
	  * if there is no suitable visualizer in the configuration.
	  */
	def visualize[R](config: VisualizationConfiguration[R]): Option[R]
}
